<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>激活码查询</title>
	<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport" />
	<meta content="yes" name="apple-mobile-web-app-capable" />
	<meta content="black" name="apple-mobile-web-app-status-bar-style" />
	<meta content="telephone=no" name="format-detection" />
     <link href="../../Ryancss/upgrade_agent.css" rel="stylesheet" type="text/css"/>
	 
	 		
		<style type="text/css">

	   .display-block{
	   display :block ;
	   }
	   
	   .display-none{
	   display :none ;
	   }
	   
	 body {
    background: #efeff4;
    color: #666;
}

  
	.aui-free-head-search {
    position: relative;
    width: 100%;
 /*   padding: 1.2rem 0 2.5rem 0; 
    background-image: -webkit-gradient(to right,#f370af 0,#5515ee 100%);
    background-image: -webkit-linear-gradient(to right,#f370af 0,#5515ee 100%);
    background-image: -moz-linear-gradient(to right,#f370af 0,#5515ee 100%);
    background-image: linear-gradient(to right,#f370af 0,#5515ee 100%);
    background-color: #4bd6ad; */
}
   
	   
	  .aui-flex-border {
    border-radius: 50px;
    padding: 0;
    background: #fff;
	
} 
	   
	.aui-flexa {
    display: -webkit-box;
    display: -webkit-flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
	
	margin: 0 auto; 
    width: 90%;
    box-shadow: 0 3px 30px #e2e2e2;
}
 

.aui-flex-box {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    min-width: 0;
    font-size: 14px;
    color: #333;
}


.aui-flex-box input {
    border: none;
    background: none;
    font-size: 0.85rem;
    padding-left: 1.4rem;
    width: 100%;
}


.aui-button-once button {
 /*   background-image: linear-gradient(to bottom,#ff047f,#ff2662);  */
    background-color: #000000;
    box-shadow: 0 0 5px #77777a;
    color: #fff;
    font-size: 0.9rem;
    padding: 0.3rem 1rem;
    border-radius: 20px;
    border: none;
    margin-top: 8px;
    margin-bottom: 8px;
    margin-right: 10px;
}   
	   
	   
	   
.aui-mon-head {
    width: 90%;
    box-shadow: 0 3px 30px #e2e2e2;
    background: #fff;
	margin-top: 20%; 
	margin-left: 5%; 
	margin-right: 5%;
    border-radius: 10px;
	padding: 1%;
}

.aui-mon-user {
    width: 70px;
    height: 70px;
    border-radius: 100%;
    margin: -30px auto;
}

.aui-mon-user img {
    width: 70px;
    height: 70px;
    display: block;
    border: 2px solid #fff;
    border-radius: 100%;
}

.aui-mon-title {
    text-align: center;
    padding-top: 2.5rem;
}

.aui-mon-title h2 {
    color: #323232;
    font-size: 0.99rem;
    font-weight: normal;
}

	   
	   
		</style>
			
	 
</head>
<body>



<section class="aui-flexView">
            <section class="aui-scrollView">
                <div class="aui-free-head-search">
                   <div class="aui-flex b-line">
                    <!--     <div class="aui-user-img" id="headimgurl">
                            <img src="">
                        </div>
                        <div class="aui-flex-box">
                            <h2 id="username"> </h2>
							
                            <p id="daili_price"> </p>
                        </div>
                        <div class="aui-arrow" onclick="faka_agent()">
                            <p>购买激活码</p>
                        </div>
                     -->  </div> 
                 
					<div class="aui-button">
						<div class="aui-flexa aui-flex-border"> 
                            <div class="aui-flex-box">
                                <input  id="kami"  type="text" placeholder="请输入想查询的激活码" >
                            </div>
                            <div class="aui-button-once" onclick="loginOff()">
                                <button>查询</button>
                            </div>
                        </div>			
			
					
                </div>

                </div>
				
						

			
                    <div class="aui-flex-box" id="search_return_default"> 
						<img src="">
					</div>
         					
		
                    <div class="aui-flex-box  display-none" id="search_return_no"> 
						<img src="">
					</div>
         		
                    <div class="aui-flex-box display-none" id="search_return_yes"> 
					
							<div class="aui-mon-head">
							
							<div style="position: absolute; background-color: #ff1679; background-size: 16px 16px; background-position: 8px -8px; color: #fff; text-align: center; height: 20px; line-height: 21px; border-radius: 8px 0 8px 0; font-size: 13px;padding-right: 10px;padding-left: 10px;">已使用</div>
							
								<div class="aui-mon-user" id="y_headimgurl">
									<img src="">
								</div>
								<div class="aui-mon-title">
									<h2 id="y_user_username">  - - - </h2>
								</div>

								<div class="aui-mon-title">
									<span  id="y_time"> 2015-07-14 </span>
								</div>

							</div>
						
						
					</div>
         

            </section>
        </section>
 
</body>

<script type="text/javascript" src="../../script/api.js" ></script>
<script type="text/javascript">
    var user_id = localStorage.getItem('user_id');
    var api_url = localStorage.getItem('api_url');
    apiready = function(){
      api.parseTapmode();
	  
	  
          //定时检测邀请码
          var timer = setInterval(function(){
         //     DataLoading();
				  var clipBoard = api.require('clipBoard');
				  clipBoard.get(function(ret, err) {
					  if (ret) {

						if (ret.value.length == localStorage.getItem('kami_length')) {
						  var kami = $api.byId('kami');
						  kami.value = ret.value;
						  
						  
							}
						 }
					});



           },3000)	  
	  

		
		

																  


    }
  //  初始化结束















	




    //激活码查询
    function loginOff(){
      var kami = $api.val($api.byId('kami'));
      if(kami == ''){
        api.toast({
            msg: '请输入要查询的激活码',
            duration: 5000, 
            location : 'middle' 
        });
        return;
      }
      if (user_id<1) {
        alert('请先登录');
        api.openWin({
            name: 'login',
            url: './login.html',
        });
        return;
      }else {
        api.showProgress({
            title: '验证中',
            text: '请稍等',
            modal: false
        });
        api.ajax({
            url: api_url+'/login/login/activation_code_srarch.html',
            method: 'get',
            data: {
                values: {
                    uid: localStorage.getItem('user_id'),
                    dianka: kami,
					key: 'qq166098756'   //安全码
                }
            }
        },function(ret, err){
            if (ret) {
                if (ret.code == 999) {
                  api.hideProgress();

		        api.toast({
					msg: ret.msg,
					duration: 5000, 
					location : 'middle' 
				});		  
				  
                  return;
                }else if(ret.code == 0){
				
				api.hideProgress();
				  //未使用
	/*	        api.toast({
					msg: ret.msg,
					duration: 5000, 
					location : 'middle' 
				});		  
				  	
 */
				
				var obj = document.getElementById("search_return_no");
				obj.setAttribute("class", "aui-flex-box display-block");
				var obj = document.getElementById("search_return_yes");
				obj.setAttribute("class", "aui-flex-box display-none");
				var obj = document.getElementById("search_return_default");
				obj.setAttribute("class", "aui-flex-box display-none");
			  
				
				
				}else if (ret.code == 1) {
                  api.hideProgress();
				  
					//已使用
	/*	        api.toast({
					msg: ret.msg,
					duration: 5000, 
					location : 'middle' 
				});		  
				  	
 */	
						
				var obj = document.getElementById("search_return_no");
				obj.setAttribute("class", "aui-flex-box display-none");
				var obj = document.getElementById("search_return_yes");
				obj.setAttribute("class", "aui-flex-box display-block");
				var obj = document.getElementById("search_return_default");
				obj.setAttribute("class", "aui-flex-box display-none");

				y_time.innerHTML = '使用时间： '+formatDateTime(ret.data['y_time']);
				y_user_username.innerHTML = ret.data['y_user_username'];
				y_headimgurl.innerHTML = '<img src="'+ ret.data['y_headimgurl'] + '">' ;	  
						
                }
 
            } else {
              api.hideProgress();

		        api.toast({
                      msg: '网络异常',
					duration: 5000, 
					location : 'middle' 
				});		  
			  
            }
        });

      }
    }


		/////////////会员过期时间获取  方法  formatDateTime  S   ////////////
		function formatDateTime(timeStamp) {
			var date = new Date();
			date.setTime(timeStamp * 1000);
			var y = date.getFullYear();
			var m = date.getMonth() + 1;
			m = m < 10 ? ('0' + m) : m;
			var d = date.getDate();
			d = d < 10 ? ('0' + d) : d;
			var h = date.getHours();
			h = h < 10 ? ('0' + h) : h;
			var minute = date.getMinutes();
			var second = date.getSeconds();
			minute = minute < 10 ? ('0' + minute) : minute;
			second = second < 10 ? ('0' + second) : second;
			return y + '/' + m + '/' + d + ' '+ h + ':' + minute + ':' +second;
		};
		/////////////会员过期时间获取  方法  formatDateTime  E   ////////////


</script>
</html>
